cmake_minimum_required(VERSION 3.0.0)
project(smartspeaker VERSION 0.1.0 LANGUAGES C CXX)

include(CTest)
enable_testing()

add_executable(smartspeaker main.cpp)
add_executable(weekday weekday.c)
add_executable(blink blink.c)
add_executable(key key.c)
target_link_libraries(key gpiod asound)
add_compile_options(-g -Wall)

add_executable(button button.c)
target_link_libraries(button gpiod)

add_executable(record record.c)
target_link_libraries(record asound)

add_executable(play play.c)
target_link_libraries(play asound)

add_executable(shici shici.c http.c)
target_link_libraries(shici curl cjson)

add_executable(asr asr.c auth.c http.c)
target_link_libraries(asr curl cjson)
target_compile_options(asr PRIVATE -D_GNU_SOURCE)

add_executable(chat chat.c auth.c)
target_link_libraries(chat curl cjson)
target_compile_options(chat PRIVATE -D_GNU_SOURCE)

add_executable(nlp nlp_llm.c http.c)
target_link_libraries(nlp curl cjson)
target_compile_options(nlp PRIVATE -D_GNU_SOURCE)

add_executable(tts tts.c auth.c)
target_link_libraries(tts curl cjson)
target_compile_options(tts PRIVATE -D_GNU_SOURCE)

add_subdirectory(snowboy)

add_executable(sbtest sbtest.c)
target_link_libraries(sbtest snowboy-wrapper snowboy-detect cblas asound)

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
